<template>
  <div class="app-container home">
    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <h1>欢迎使用MagicErp管理系统</h1>
        <el-divider />
      </el-col>
    </el-row>

    <el-row :gutter="20">
      <el-col :sm="24" :lg="24">
        <el-card class="quick-access">
          <div slot="header" class="clearfix">
            <span>快捷起草</span>
          </div>
          <div class="quick-buttons">
            <el-button type="primary" plain icon="el-icon-s-truck">
              采购计划
            </el-button>
            <el-button type="primary" plain icon="el-icon-document">
              合同管理
            </el-button>
            <el-button type="primary" plain icon="el-icon-box">
              采购入库
            </el-button>
            <el-button type="primary" plain icon="el-icon-back">
              供应商退货
            </el-button>
            <el-button type="primary" plain icon="el-icon-sell">
              供应商结算
            </el-button>
            <el-button type="primary" plain icon="el-icon-menu">
              订单列表
            </el-button>
            <el-button type="primary" plain icon="el-icon-delete">
              订单退货
            </el-button>
            <el-button type="primary" plain icon="el-icon-outbox">
              出库管理
            </el-button>
            <el-button type="primary" plain icon="el-icon-transfer">
              商品调拨
            </el-button>
            <el-button type="primary" plain icon="el-icon-share">
              商品借
出            </el-button>
            <el-button type="primary" plain icon="el-icon-exchange">
              商品换货
            </el-button>
            <el-button type="primary" plain icon="el-icon-check">
              库存盘点
            </el-button>
            <el-button type="primary" plain icon="el-icon-s-claim">
              库存报损
            </el-button>
            <el-button type="primary" plain icon="el-icon-warning">
              库存预警
            </el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <el-row :gutter="20" class="dashboard-row">
      <el-col :xs="24" :sm="24" :md="12" :lg="12">
        <el-card class="inventory-alert">
          <div slot="header" class="clearfix">
            <span>库存预警</span>
            <el-button style="float: right; padding: 3px 0" type="text">查看更多</el-button>
          </div>
          <div class="alert-list">
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 小侯-采购部:</span>
              <span class="alert-location">北京通州仓</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 小侯-采购部:</span>
              <span class="alert-location">北京顺义仓</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 小侯-市场部:</span>
              <span class="alert-location">上海浦东仓</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 小侯-市场部:</span>
              <span class="alert-location">上海青浦仓</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 小侯-技术部:</span>
              <span class="alert-location">秦皇岛北戴河仓</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 阿里生产部:</span>
              <span class="alert-location">阿里盒马仓</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 1店:</span>
              <span class="alert-location">杭州总部仓库</span>
            </div>
            <div class="alert-item">
              <span class="alert-name">xxx 你你你</span>
              <span class="alert-department">/ 杭州总部:</span>
              <span class="alert-location">科大讯飞</span>
            </div>
          </div>
        </el-card>
      </el-col>

      <el-col :xs="24" :sm="24" :md="12" :lg="12">
        <el-card class="pending-orders">
          <div slot="header" class="clearfix">
            <span>待出库订单列表</span>
            <el-button style="float: right; padding: 3px 0" type="text">查看更多</el-button>
          </div>
          <el-table :data="orders" style="width: 100%">
            <el-table-column prop="orderNo" label="订单编号" width="180"></el-table-column>
            <el-table-column prop="warehouse" label="仓库名称" width="120"></el-table-column>
            <el-table-column prop="orderTime" label="下单时间"></el-table-column>
          </el-table>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {
      orders: [
        {
          orderNo: "tt/2025080300027",
          warehouse: "硬质",
          orderTime: "2025-06-03 15:48:14"
        },
        {
          orderNo: "tt/20250529000026",
          warehouse: "测试仓库",
          orderTime: "2025-05-29 16:32:51"
        },
        {
          orderNo: "tt/20250521000025",
          warehouse: "硬质",
          orderTime: "2025-05-21 13:57:34"
        },
        {
          orderNo: "tt/20250513000024",
          warehouse: "硬质",
          orderTime: "2025-05-13 14:07:59"
        },
        {
          orderNo: "tt/20250429000023",
          warehouse: "测试仓库",
          orderTime: "2025-04-29 13:41:13"
        }
      ]
    };
  }
};
</script>

<style scoped lang="scss">
.home {
  .quick-access {
    margin-bottom: 20px;

    .quick-buttons {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;

      .el-button {
        margin: 0;
      }
    }
  }

  .dashboard-row {
    margin-top: 20px;
  }

  .inventory-alert {
    .alert-list {
      .alert-item {
        padding: 8px 0;
        border-bottom: 1px solid #eee;

        &:last-child {
          border-bottom: none;
        }

        .alert-name {
          font-weight: bold;
        }

        .alert-department {
          color: #666;
        }

        .alert-location {
          color: #409EFF;
        }
      }
    }
  }

  .pending-orders {
    height: 100%;

    .el-table {
      font-size: 14px;
    }
  }

  h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #333;
  }
}
</style>
